NativeCameraOutput

A CameraOutput backed by a CameraX UseCase (port of V5's public/NativeCameraOutput.kt).

This is an extension point for plugin modules: a module (e.g. barcode) adds its own output to a CameraSession by implementing NativeCameraOutput, and the session binds the UseCase it creates like the built-in outputs'.

Types

Link copied to clipboard
data class Config(val fpsRange: Range<Int>?, val previewStabilizationMode: TargetStabilizationMode?, val videoStabilizationMode: TargetStabilizationMode?, val videoDynamicRange: TargetDynamicRange?, val photoHDR: Boolean?)

Resolved configuration for a camera output. null values mean "no constraint specified, platform decides".

Link copied to clipboard
class PreparedUseCase(val useCase: UseCase, onAttached: () -> Unit)

A UseCase prepared by a NativeCameraOutput, but not yet attached to the Camera. After it has been bound with bindToLifecycle(...), call notifyAttached to let the output know it can use the live UseCase.

Properties

Link copied to clipboard
abstract val currentResolution: Size?

The resolution this output is currently streaming at, or null if it is not connected yet.

Link copied to clipboard
abstract val mediaType: MediaType

The MediaType of this output.

Link copied to clipboard
abstract val mirrorMode: MirrorMode

The currently selected MirrorMode.

Link copied to clipboard

The orientation of the content produced by this output.

Functions

Link copied to clipboard
open override fun close()

Same as dispose, to use a CameraOutput with use { }.

Link copied to clipboard

Creates a PreparedUseCase for the given config. This may be called multiple times to probe feature compatibility (e.g. in ConstraintResolver); only the winning one gets PreparedUseCase.notifyAttached. An output may re-use a previously created UseCase if the given config is the same for it.

Link copied to clipboard
abstract fun dispose()

Eagerly disposes the native resources this output holds (its threads, analyzers, delegates, sounds...), like VisionCamera's HybridObject.dispose().